package io.geekidea.boot.auth.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.geekidea.boot.common.constant.SystemConstant;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

@Data
@Schema(description = "登录Vo")
public class LoginVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 3338162302996457084L;
    @Schema(description = "需要授权的api")
    Set<String> adminAuthApi;
    @Schema(description = "用户Id")
    private Long userId;
    @Schema(description = "用户名")
    private String username;
    @Schema(description = "是否是管理员")
    private boolean admin;
    @Schema(description = "角色ID")
    private List<Long> roleIds;
    @Schema(description = "组织ID")
    private List<Long> orgIds;
    @Schema(description = "系统类型 1：管理后台，2：用户端")
    private Integer systemType;
    @Schema(description = "表单功能权限集合<formId,<url,resourceId>>")
    private Map<Long, Map<String, Long>> formFunPerms;
    @Schema(description = "url功能权限集合<url,resourceId>")
    private Map<String, Long> urlFunPerms;
    @Schema(description = "语言类型")
    private String locale = SystemConstant.DEFAULT_LOCALE;

    @Schema(description = "头像")
    private String avatar;

    @Schema(description = "昵称")
    private String nickname;

    @Schema(description = "accessToken")
    private String accessToken;

    @Schema(description = "用于调用刷新`accessToken`的接口时所需的`token`")
    private String refreshToken;
    @Schema(description = "accessToken的过期时间（格式'xxxx/xx/xx xx:xx:xx'）")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    private Date expires;
    @Schema(description = "租户编码")
    private String tenantCode;
}
